% Parameters for intensity channel 

%% input parameters
% fpath = 'balloons.png'; %'pout.tif';
inputvideo = 'V3V100013_010.crop.avi'; %'video.avi';
% inputvideo = 'R:\fourier\Srinidhi\sample_videos\V3V100004_005_512x512.avi';
color_img = 1;  % flag to enable pre-processing if color-image

%% algorithmic parameters
nr = 256; %128;       %input image size - num of rows
nc = 256; %128;       %input image size - num of cols



bin_dat_bar = 0; %1;     %0 : dat file (ascii), 1 : binary file

fpath = 'R:\kesturvy\Projects\DNV6F6_PCIE\FPGA_Reference_Designs\boards\dn0200_dnv6f6pcie\SaliencyRef_SX475T\simulate\datfiles\'; %'../Data/onboard/'; %'../Data/bin/';

%% for comparing hardware result
%% pre-processing

  %  im1 = imread(fpath);
   % im2 = imresize(im1, [nr, nc]);
 
    mov = aviread(inputvideo) ; 
    NUM_FRAMES = 2; %size(mov,2);
    
    I_prev = zeros(nr,nc);
%    for i = 1:NUM_FRAMES %will go to number of frames
    %% Frame ID
    i = 36;
    datfileframe = strcat(fpath, '3C36F','-');
    
    %% Current chip
    im2= mov(1,i).cdata;
    img2 = zeros(nr,nc);
    img2 = im2(257:512, 257:512,:); %chip 3 in 512x512 frame 
    
%     im2 = imresize(im2, [nr,nc]);   % resize to desired img sizer

    datfile = strcat(datfileframe, 'c', '.dat');
    rgb2dat_n(datfile, double(im2), 2); % 2 pixels per line of the file => 64-bit data
    
        %% Previous chip
    im2= mov(1,i-1).cdata;
    img2 = zeros(nr,nc);
    img2 = im2(257:512, 257:512,:); %chip 3 in 512x512 frame 
    
%     im2 = imresize(im2, [nr,nc]);   % resize to desired img sizer

    datfile = strcat(datfileframe, 'p', '.dat');
    rgb2dat_n(datfile, double(im2), 2); % 2 pixels per line of the file => 64-bit data

                 
%         
%         I_prev = I;
%    end 
